//
//  HWRecommentTableViewCell.m
//  JWC
//
//  Created by lanou on 16/4/11.
//  Copyright © 2016年 陈帅. All rights reserved.
//

#import "HWRecommentTableViewCell.h"
#import "HWUserModel.h"
#import "HWContentImageView.h"
#import "HWContentVideoView.h"
#import "HWContentVoiceView.h"
#import "HWCommentViewController.h"
#import "UIImageView+Webcache.h"
#import "UIImageView+Header.h"

@interface HWRecommentTableViewCell ()

@property (weak, nonatomic) IBOutlet UIImageView *headImage;
@property (weak, nonatomic) IBOutlet UILabel *name;
@property (weak, nonatomic) IBOutlet UILabel *creatTime;
@property (weak, nonatomic) IBOutlet UIButton *more;
@property (weak, nonatomic) IBOutlet UIButton *comment;
@property (weak, nonatomic) IBOutlet UIButton *cai;
@property (weak, nonatomic) IBOutlet UIButton *ding;
@property (weak, nonatomic) IBOutlet UIButton *share;
@property (weak, nonatomic) IBOutlet UILabel *hotComment;
@property (weak, nonatomic) IBOutlet UILabel *text;
@property (weak, nonatomic) IBOutlet UIView *hotCommentView;


@property (nonatomic, strong)HWContentImageView *myImageView;
@property (nonatomic, strong)HWContentVideoView *videoView;
@property (nonatomic, strong)HWContentVoiceView *voiceView;
@end

@implementation HWRecommentTableViewCell

- (void)prepareForReuse
{
    [super prepareForReuse];
    
}

//+ (instancetype)cell
//{
//    return [[[NSBundle mainBundle] loadNibNamed:NSStringFromClass(self) owner:nil options:nil] firstObject];
//}

- (void)setRecommentFrame:(HWFrame *)frame
{
    _frame = frame;
    HWRecommendModel *model = frame.model;
    
    [self.headImage setHeader:model.u.header.firstObject];
    self.name.text = model.u.name;
    self.creatTime.text = model.passtime;
    self.text.text = model.text;
    
    [self.ding setTitle:model.up forState:UIControlStateNormal];
    [self.cai setTitle:[NSString stringWithFormat:@"%ld", (long)model.down] forState:UIControlStateNormal];
    [self.share setTitle:model.forward forState:UIControlStateNormal];
    [self.comment setTitle:model.comment forState:UIControlStateNormal];
    
    // 热门评论
    if (model.top_comment)
    {
        self.hotCommentView.hidden = NO;
        self.hotComment.text = [NSString stringWithFormat:@"%@ : %@", model.top_comment.u.name, model.top_comment.content];
    }
    else
    {
        self.hotCommentView.hidden = YES;
    }
    
    if ([model.type isEqualToString:@"image"] || [model.type isEqualToString:@"gif"])
    {
        
    }
}

- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
